<?php

namespace app\admin\command;

use app\common\util\Tools;
use think\console\Input;
use think\console\Output;
use think\facade\Log;

class InvoiceTest extends CommonTest
{

    //再命令窗口中执行“php think interface-InvoiceTest”
    protected function configure()
    {
        $this->setName('interface-InvoiceTest')
            ->setDescription('接口测试');
    }

    public function execute(Input $input, Output $output)
    {
        parent::execute($input, $output);

        //Route::any('admin/invoice/create', 'admin/invoice/toAddInvoice');                                                       // 添加发票
        $data = Tools::curl($this->url . "admin/invoice/create", json_encode(["token" => "$this->token", "type" => "1", "userId" => 1, "headName" => "网商", "money" => 1]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";

//        //Route::any('admin/invoice/getPageList', 'admin/invoice/getInvoiceList');                                                // 发票列表，分页功能
        $data = Tools::curl($this->url . "admin/invoice/getPageList", json_encode(["token" => "$this->token"]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";

        //Route::any('admin/invoice/getDetailsById', 'admin/invoice/getInvoiceDetail');                                           // 发票的详细信息
        $data = Tools::curl($this->url . "admin/invoice/getDetailsById", json_encode(["token" => "$this->token", "id" => 1]));
        Log::write("post". var_export($data,true));
        echo $data . "\n\n";

    }
}
